// Home module
export default {
  namespaced: true,
  state: {
    map: [
      {
        id: 1,
        name: "Map 1",
        router: "/maincity",
        topId: null,
        topRouter: null,
        leftId: null,
        leftRouter: null,
        rightId: 2,
        rightRouter: "/subsidiaryright",
        downId: null,
        downRouter: null,
      },
      {
        id: 2,
        name: "Map 2",
        router: "/subsidiaryright",
        topId: null,
        topRouter: null,
        leftId: 1,
        leftRouter: "/maincity",
        rightId: null,
        rightRouter: null,
        downId: null,
        downRouter: null,
      },
    ],
    // 当前地图id
    currentId: 1,
  },
  mutations: {
    // 定义修改状态的方法
    UPDATE_CURRENT_ID(state, currentId) {
      state.currentId = currentId;
    },
  },
  actions: {},
  getters: {
    getMapData: (state) => state.map,
    getCurrentId: (state) => state.currentId,
    getCurrentMapName: (state) => {
      return state.map.filter((item) => item.id == state.currentId)[0].name;
    },
  },
};
